//
//  UserInfoManager.m
//  Cat
//
//  Created by lushitong on 2018/12/4.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "UserInfoManager.h"
#import "FMDBUser.h"

@implementation UserInfoManager

+ (FMDBUser *)userWithPhone:(NSString *)phone {
	if ([FMDBUser bg_isExistForTableName:FMDB_User]) {
		NSString *where = [NSString stringWithFormat:@"where %@=%@",bg_sqlKey(@"phone"),bg_sqlValue(phone)];
		NSArray *userArray =[FMDBUser bg_find:FMDB_User where:where];
		return userArray.firstObject;
	}
	return nil;
}

+ (BOOL)deleteWithPhone:(NSString *)phone {
	if ([FMDBUser bg_isExistForTableName:FMDB_User]) {
		NSString *where = [NSString stringWithFormat:@"where %@=%@",bg_sqlKey(@"phone"),bg_sqlValue(phone)];
		return [FMDBUser bg_delete:FMDB_User where:where];
	}
	return NO;
	
}
@end
